---
layout: m1x_soap
title: Add Option
---

<h3><a name="product_attribute.addOption-Module%3AProductAttributesAPI"></a>Module: Product Attributes API</h3>

<h4><a name="product_attribute.addOption-Resource%3Aproductattribute"></a>Resource: product_attribute</h4>


<h5><a name="product_attribute.addOption-Method%3A"></a>Method:</h5>

<ul>
	<li>product_attribute.addOption (SOAP V1)</li>
	<li>catalogProductAttributeAddOption (SOAP V2)</li>
</ul>


<p>Allows you to add a new option for attributes with selectable fields.</p>

<p><b>Arguments:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> string </td>
<td> attribute <br class="atl-forced-newline" /> </td>
<td> Attribute code or ID </td>
</tr>
<tr>
<td> array </td>
<td> data </td>
<td> Array of catalogProductAttributeOptionEntityToAdd </td>
</tr>
</tbody></table>


<p><b>Return:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> boolean </td>
<td> result </td>
<td> True on success </td>
</tr>
</tbody></table>


<p>The <b>catalogProductAttributeOptionEntityToAdd</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> array </td>
<td> label </td>
<td> Array of catalogProductAttributeOptionLabel </td>
</tr>
<tr>
<td> int </td>
<td> order </td>
<td> Option order </td>
</tr>
<tr>
<td> int </td>
<td> is_default </td>
<td> Defines whether the option is a default one </td>
</tr>
</tbody></table>


<p>The <b>catalogProductAttributeOptionLabel</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> ArrayOfString </td>
<td> store_id <br class="atl-forced-newline" /> </td>
<td> Array of store view IDs </td>
</tr>
<tr>
<td> string </td>
<td> value <br class="atl-forced-newline" /> </td>
<td> Text label </td>
</tr>
</tbody></table>

<p><b>Faults:</b></p>


<table><tbody>
<tr>
<th> Fault Code </th>
<th> Fault Message </th>
</tr>
<tr>
<td> 101 </td>
<td> Requested attribute not found. </td>
</tr>
<tr>
<td> 104 </td>
<td> Incorrect attribute type. </td>
</tr>
<tr>
<td> 108 </td>
<td> Unable to add option. </td>
</tr>
</tbody></table>


<h4><a name="product_attribute.addOption-Examples"></a>Examples</h4>

<h5><a name="product_attribute.addOption-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');

$attributeCode = "new_attribute";
$optionToAdd = array(
    "label" =&gt; array(
        array(
            "store_id" =&gt; 0,
            "value" =&gt; "New Option"
        )
    ),
    "order" =&gt; 0,
    "is_default" =&gt; 0
);

$result = $proxy-&gt;call(
    $sessionId,
    "product_attribute.addOption",
    array(
         $attributeCode,
         $optionToAdd
    )
);</pre>
		</div>
</div></div>

<h5><a name="product_attribute.addOption-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">&lt;?php
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

//V2
$session = $client-&gt;login('apiUser', 'apiKey');

// V2 WS-I Mode
//$response = $client-&gt;login(array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey'));
//$session = $response-&gt;result;

$attributeCode = "new_attribute";

//v2

$label = array (
   array(
    "store_id" =&gt; array("0"),
    "value" =&gt; "some random data"
   )
  );

$data = array(
   "label" =&gt; $label,
   "order" =&gt; "10",
   "is_default" =&gt; "1"
  );

$orders = $client-&gt;catalogProductAttributeAddOption($session, $attributeCode, $data); 



//V2 WSI
//WSDL WSI does not describe this method
//$result = $client-&gt;catalogProductAttributeAddOption(...);
//$orders = $result-&gt;result-&gt;complexObjectArray;

var_dump ($orders);
?&gt;</pre>
		</div>
</div></div>

				    
Create the Magento file system owner                   			    
